<%@ page contentType="text/html;charset=utf-8" 
	import="org.springframework.web.context.*,com.zh.UserBean,org.springframework.web.context.support.*,com.zh.Util,java.util.*,com.zh.User,com.zh.House"
%>
<html>
  <head>
    <title>修改业主资料信息</title>
     <script language="JavaScript" src="script/com.js"></script>
     <script language="JavaScript">
       function check(){
       	 
       	 document.all.ss.submit();
       }
     </script>
     <style>
      table{
	         border-collapse:collapse;
	       }
	       table,th,td {
	       
	       border:1px solid black;
	       }
	       .mima {
	       width:100%;
	       height:40px;
	       background-color:#ADD8E6;
	       }
	       .zi {
	       font-size:20px;
	       position:relative;
	       left:45%;
	       margin-left:-30px;
	       line-height:40px;
	       }
	</style>
  </head>
  <body>
 	<jsp:useBean id="userBean" class="com.zh.UserBean" scope="session"/>
	<div class="mima"><font class="zi">修改业户信息</font></div>
	<% 
		User u = (User)request.getAttribute("object");
	 %>
	<form action="SuperServlet" method="post" id="ss">
	<table width="80%" border="1" style="margin-left:150px;margin-top:15px">	
	  <tr >
	    <td align="center">业主姓名:</td>
	    <td><input name="username" id="username" value="<%= u.getUsername() %>"/></td>
	  </tr>
	  <tr >
	  	<td align="center">居住地址:</td>
	  	<td>
      	  <select name="useraddress">
      	  <% 
			//获取WebApplicationContext
			WebApplicationContext w=
			   WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
			Util util = (Util)w.getBean("Util");
			List<String> address = util.getHouseAddress();
			House h = (House)util.getObject("house",u.getHouseId());
			for(String name:address){
  	   			String flag = "";
  	   			if(name.equals(h.getHouseaddress())){
  	   				flag = "selected";
  	   			}
      	    %>
      	    	<option value="<%= name %>" <%= flag %>><%= name %></option>
      	    <% 
      	    	}
      	     %>
      	  </select>
	  	</td>
	  </tr>
	  <tr >
	  	<td align="center">业主性别:</td>
	  	<td><input name="usersex" id="usersex" 
	  		value="<%= u.getUsersex() %>"/></td>
	  </tr>
	  <tr >
	  	<td align="center"> 业主职业:</td>
	  	<td><input name="userprofession" id="userprofession" value="<%= u.getUserprofession() %>"/></td>
	  </tr>
	  <tr >
	  	<td align="center">业主电话:</td>
	  	<td><input name="userphone" id="userphone" value="<%= u.getPhonenumber() %>"/></td>
	  </tr>
	  <tr >
	  	<td align="center">入住时间:</td>
	  	<td><input type="date" name="livetime" id="livetime" value="<%= u.getLivetime() %>"/></td>
	  </tr>	
	  <tr >
	  	<td align="center">居住人数:</td>
	  	<td><input name="livecount" id="livecount" value="<%= u.getLivecount() %>"/></td>
	  </tr>
	  <tr>
		   <td  colspan="2" >
		   <div  style="position:relative;left:35%;">
		   <input type="button" value="提交" id="xg" onclick="JavaScript:check()" style="cursor:hand"/>
		   <input type="button" value="重置" id="cz" onclick="JavaScript:document.all.ss.reset()"  style="cursor:hand">
		   </div>
		   </td>
		 </tr> 
	</table>
	<input type="hidden" name="action" value="mduser"/>
	<input type="hidden" name="userId" value="<%= u.getUserId() %>"/>
	
	</form>
  </body>
</html>